package cn.jbolt.ai.app.vo;


import cn.jbolt.ai.core.chain.node.base.RenderType;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

//@JsonIgnoreProperties(ignoreUnknown = true)
public class AiChatData {
    //前端:user,后端返回:assistant
    public final static String ROLE_USER = "user";
    public final static String ROLE_ASSISTANT = "assistant";

    //format:格式
    private String role;
    //内容
    private AiChatContent content;
    //格式化,后期可能会扩展为html,img,markdown等
    private RenderType renderType;
    //出现异常,后端会返回这个msg
    private String msg;


    public static AiChatData createUserMsg(String content, RenderType renderType) {
        AiChatData data = new AiChatData();
        data.setRole(ROLE_USER);
        data.setRenderType(renderType);
        data.setContent(new AiChatContent(content));
        return data;
    }
    public static AiChatData createAssistantMsg(String content, RenderType renderType) {
        AiChatData data = new AiChatData();
        data.setRole(ROLE_ASSISTANT);
        data.setRenderType(renderType);
        data.setContent(new AiChatContent(content));
        return data;
    }



    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class AiChatContent {
        //内容,文本
        private String text;

        private String[] imgs;

        public AiChatContent(String text) {
            this.text = text;
        }

        public AiChatContent() {
        }

        // Getters and Setters
        public String getText() {
            return text;
        }

        public void setText(String text) {
            this.text = text;
        }

        public String[] getImgs() {
            return imgs;
        }

        public void setImgs(String[] imgs) {
            this.imgs = imgs;
        }
    }


    public AiChatContent getContent() {
        return content;
    }

    public AiChatData setContent(AiChatContent content) {
        this.content = content;
        return this;
    }

    public RenderType getRenderType() {
        return renderType;
    }

    public AiChatData setRenderType(RenderType renderType) {
        this.renderType = renderType;
        return this;
    }

    public String getMsg() {
        return msg;
    }

    public AiChatData setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public String getRole() {
        return role;
    }

    public AiChatData setRole(String role) {
        this.role = role;
        return this;
    }


}
